<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

{config_load file="catalog.conf"}
{config_load file=$module->getConfig()}

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="{$language->getLanguage()}" dir="{$language->getDirection()}">
	<head>
		{include file=$theme->getTemplateUrl("head_common.tpl")}
		<title>{#PAGE_TITLE#}</title>
	</head>
	
	<body>
		{include file=$theme->getTemplateUrl("body_start.tpl")}
		
		<h2>{#HEADING_TITLE#}</h2>
		
		{if $messageStack->getSize("search") > 0}
			<ul class="errors" id="messages">
				{foreach item="message" from=$messageStack->getMessages("search")}
					<li class="{$message.type}">{$theme->get_config_vars($message.message)}</li>
				{/foreach}
			</ul>
		{/if}
		
		<form action="{$smarty.const.FILENAME_CATALOG}" method="get" onsubmit="return check_form(this);">
			<input type="hidden" name="view" value="{$smarty.get.view}" />
			
			<fieldset>
				<legend>{#HEADING_SEARCH_CRITERIA#}</legend>
				<p>
					<input type="text" name="keywords" id="keywords" value="{$smarty.get.keywords}" />
				</p>
				<p>
					<input type="checkbox" name="search_in_description" id="search_in_description" value="1"{if $smarty.get.search_in_description == "1"} checked="checked"{/if} />
					<label for="search_in_description">
						<small>{#TEXT_SEARCH_IN_DESCRIPTION#}</small>
					</label>
				</p>
			</fieldset>
			<p>
				{strip}
				<a href="javascript:popupWindow('{$FILENAME_POPUP_SEARCH_HELP}')">
					<small>{#TEXT_SEARCH_HELP_LINK#}</small>
				</a>
				{/strip}
			</p>
			<fieldset>
				<p>
					<label for="categories_id">
						{#ENTRY_CATEGORIES#}
					</label>
					<select name="categories_id" id="categories_id">
						<option value="">{#TEXT_ALL_CATEGORIES#}</option>
						{foreach item="category" from=$catalog->getCategories()}
							{strip}
							<option value="{$category->getId()}" {if $category->getId() == $smarty.get.categories_id} selected="selected"{/if}>
								{$category->getName()}
							</option>
							{/strip}
						{/foreach}
					</select>
					<br />
					<input type="checkbox" name="inc_subcat" id="inc_subcat" value="1"{if $smarty.get.inc_subcat == "1"} checked="checked"{/if} />
					<label for="inc_subcat">
						{#ENTRY_INCLUDE_SUBCATEGORIES#}
					</label>
				</p>
				<p>
					<label for="manufacturers_id">
						{#ENTRY_MANUFACTURERS#}
					</label>
					<select name="manufacturers_id" id="manufacturers_id">
						<option value="">{#TEXT_ALL_MANUFACTURERS#}</option>
						{foreach item="manufacturer" from=$catalog->getManufacturers()}
							{strip}
							<option value="{$manufacturer->getId()}" {if $manufacturer->getId() == $smarty.get.manufacturers_id} selected="selected"{/if}>
								{$manufacturer->getName()}
							</option>
							{/strip}
						{/foreach}
					</select>
				</p>
				<p>
					<label for="ptrom">{#ENTRY_PRICE_FROM#}</label>
					<input type="text" name="pfrom" id="pfrom" value="{$smarty.get.pfrom}" />
				</p>
				<p>
					<label for="pto">{#ENTRY_PRICE_TO#}</label>
					<input type="text" name="pto" id="pto" value="{$smarty.get.pto}" />
				</p>
				<p>
					<label for="dfrom">{#ENTRY_DATE_FROM#}</label>
					<input type="text" name="dfrom" id="dfrom", value="{if $smarty.get.dfrom}{$smarty.get.dfrom}{else}{#DOB_FORMAT_STRING#}{/if}" />
				</p>
				<p>
					<label for="dto">{#ENTRY_DATE_TO#}</label>
					<input type="text" name="dto" id="dto" value="{if $smarty.get.dto}{$smarty.get.dto}{else}{#DOB_FORMAT_STRING#}{/if}" />
				</p>
			</fieldset>
			<p><input type="submit" name="do_search" value="{#TEXT_BUTTON_SEARCH#}" /></p>
		</form>
		
		{include file=$theme->getTemplateUrl("body_end.tpl")}
	</body>
</html>

